﻿
using RFIDData.Data;
using RFIDData.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Phoenix_RFID
{
	public partial class CardList : Form
	{
		Dbman db = new Dbman();
		public CardList()
		{
			InitializeComponent();
		}

		private void CardList_Load(object sender, EventArgs e)
		{
			DgvCardList.AutoGenerateColumns = false;
			DgvCardList.DataSource = db.CardList();
		}

		private void btnSearch_Click(object sender, EventArgs e)
		{
			if (txtCardNo.Text == "" && txtEmNo.Text == "")
			{
				DgvCardList.DataSource = db.CardList();
			}
			else
			{
				Card ca = new Card
				{
					CaNo = txtCardNo.Text,
					EmNo = int.Parse(txtEmNo.Text),
					CDate = DtpCard.Value
				};
				DgvCardList.DataSource = db.CardList(ca);
			}
		}
	}
}
